package com.example.administrator.myapplication;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by Administrator on 2017/5/22.
 */

public class CustomBroadcast extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Intent newService = new Intent(context, CustomService.class);
        switch (intent.getAction()) {
            case "start":
                newService.setAction("STARTMUSICE1");
                Log.e("test4","STARTMUSICE");
                break;

            case "stop":
                newService.setAction("STOPMUSICE1");
                Log.e("test5","STOPMUSICE");
                break;

            case "pause":
                newService.setAction("PAUSEMUSICE1");
                Log.e("test6","PAUSEMUSICE");
                break;
        }
        context.startService(newService);
    }
}
